package com.zhentao.new_z5.service.into;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhentao.new_z5.dao.UserDao;
import com.zhentao.new_z5.pojo.User;
import com.zhentao.new_z5.service.UserService;
import com.zhentao.new_z5.vo.UserRoleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserIm implements UserService {
    @Autowired
    UserDao dao;


    @Override
    public User login(String username, String password) {
        return dao.login(username,password);
    }

    @Override
    public void UserAdd(User user) {
        dao.UserAdd(user);
    }

    @Override
    public void UserRole(Integer uid) {
        dao.UserRole(uid);
    }

    @Override
    public User show(int uid) {
        return dao.show(uid);
    }

    @Override
    public void update(User user) {
        dao.update(user);
    }

    @Override
    public PageInfo<UserRoleVo> findUser(UserRoleVo role) {
        PageHelper.startPage(role.getPagenum(),role.getPagesize());
        List<UserRoleVo> user=dao.findUser();
        return new PageInfo<UserRoleVo>(user);
    }

    @Override
    public void delete(User user) {
        dao.delete(user);
    }

    @Override
    public void deleteUR(User user) {
        dao.deleteUR(user);
    }
}
